package vista;

import java.awt.BorderLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import controlador.interfaces.IControladorUsuario;
import vista.interfaces.IVistaUsuario;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VistaUsuario2 extends JFrame implements IVistaUsuario {

	private JPanel jPanel1;
	private JTextArea txtNombre;
	private JCheckBox chkGuardar;
	private JTextArea txtRut;
	private JLabel lblRut;
	private JLabel lblNombre;
	private IControladorUsuario controladorUsuario;

	
	public VistaUsuario2() throws HeadlessException {
		super();
		initGUI();
	}

	public void mostrar() {
		this.setVisible(true);
		{
			jPanel1 = new JPanel();
			getContentPane().add(jPanel1, BorderLayout.CENTER);
			jPanel1.setLayout(null);
			jPanel1.setPreferredSize(new java.awt.Dimension(325, 157));
			{
				lblNombre = new JLabel();
				jPanel1.add(lblNombre);
				lblNombre.setText("Nombre:");
				lblNombre.setBounds(39, 24, 71, 17);
			}
			{
				lblRut = new JLabel();
				jPanel1.add(lblRut);
				lblRut.setText("Rut:");
				lblRut.setBounds(52, 80, 71, 17);
			}
			{
				txtNombre = new JTextArea();
				jPanel1.add(txtNombre);
				txtNombre.setBounds(115, 12, 186, 59);
			}
			{
				txtRut = new JTextArea();
				jPanel1.add(txtRut);
				txtRut.setBounds(117, 78, 181, 83);
			}
			{
				chkGuardar = new JCheckBox();
				jPanel1.add(chkGuardar);
				chkGuardar.setText("Guardar");
				chkGuardar.setBounds(38, 175, 60, 21);
				chkGuardar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						chkGuardarActionPerformed(evt);
					}
				});
			}
		}
	}
	
	@Override
	public String getNombre() {
		return txtNombre.getText();
	}

	@Override
	public String getRut() {	
		return txtRut.getText();
	}

	@Override
	public void setNombre(String nombre) {
		this.txtNombre.setText(nombre);
	}

	@Override
	public void setRut(String rut) {
		this.txtRut.setText(rut);
	}

	@Override
	public void setControlador(IControladorUsuario controladorUsuario) {
		this.controladorUsuario = controladorUsuario;
	}
	
	private void initGUI() {
		try {
			{
				this.setSize(333, 242);
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	private void btnGuardarActionPerformed(ActionEvent evt) {
		
	}
	
	private void chkGuardarActionPerformed(ActionEvent evt) {
		this.controladorUsuario.guardar();
	}

}
